function clearAllEnv(){
		$("textarea").val("");
	}
	
	
function addAllEnvConfigs(){
	var branchValue=document.getElementById("branchName2").value;
	var envConfig=document.getElementById("envConfigInfo").value;
	var bugNum=document.getElementById("bugnum2").value;
	if (envConfig!=null&&branchValue!="--请选择分支名称--"&&bugNum!=""){
			var postData={
			"file_path": "EnvConfig"+getNowTime2(),
			"branch_name": branchValue,
			"commit_message": "bug#"+bugNum,
			"content": envConfig
			}
			$.ajax({
			type:"POST",
			url: "http://gitlab.idanlu.com/api/v3/projects/110/repository/files?private_token=s6ds3VWzz6PAsBq_t9U4",
			data: postData,
			beforeSend: function () {  
				// 禁用按钮防止重复提交  
				$("#subBtnEnv").attr({ disabled: "disabled" });  
				layer.load(0, {shade: [0.4,'#E8E8E8',true] });
			}, 
			success: function(data){
				layer.alert("提交成功，配置文件名："+data.file_path, {
									closeBtn:0,
									icon: 6,
									skin: 'layer-ext-moon'
						},function(){
							document.getElementById("branchName2").options.selectedIndex = 0;
							$("textarea").val("");
							$("#bugnum2").val("");
							$("#subBtnEnv").removeAttr("disabled");  
							layer.close(layer.index);
						});
				//window.location.reload();
			},
			complete: function () { 
				layer.closeAll('loading'); 
				$("#subBtnEnv").removeAttr("disabled");
			},  
			error: function (data) {  
				console.info("error: " + data.responseText);
				layer.alert('提交失败！请检查Bug号是否填写正确！', {
									icon: 5,
									skin: 'layer-ext-moon'
						});
			}  
			});
			
			}	
	else{
			if(branchValue=="--请选择分支名称--"){
				layer.alert('分支名称不能为空，请选择分支名称', {
									icon: 5,
									skin: 'layer-ext-moon'
						});
			}
			if(bugNum==""){
				layer.alert('bug号不能为空', {
									icon: 5,
									skin: 'layer-ext-moon'
						});
			}
		}
}

function addAllClientConfigs(){
	var branchValue=document.getElementById("branchName3").value;
	var clientConfig=document.getElementById("clientConfigInfo").value;
	var bugNum=document.getElementById("bugnum3").value;
	if (clientConfig!=null&&branchValue!="--请选择分支名称--"&&bugNum!=""){
			var postData={
			"file_path": "MatrixFrontent"+getNowTime2(),
			"branch_name": branchValue,
			"commit_message": "bug#"+bugNum,
			"content": clientConfig
			}
			$.ajax({
			type:"POST",
			url: "http://gitlab.idanlu.com/api/v3/projects/110/repository/files?private_token=s6ds3VWzz6PAsBq_t9U4",
			data: postData,
			beforeSend: function () {  
				// 禁用按钮防止重复提交  
				$("#subBtnClient").attr({ disabled: "disabled" });  
				layer.load(0, {shade: [0.4,'#E8E8E8',true] });
			}, 
			success: function(data){
				layer.alert("提交成功，配置文件名："+data.file_path, {
									closeBtn:0,
									icon: 6,
									skin: 'layer-ext-moon'
						},function(){
							document.getElementById("branchName3").options.selectedIndex = 0;
							$("textarea").val("");
							$("#bugnum3").val("");
							$("#subBtnClient").removeAttr("disabled");  
							layer.close(layer.index);
						});
				//window.location.reload();
			},
			complete: function () { 
				layer.closeAll('loading');
				$("#subBtnClient").removeAttr("disabled");
			},  
			error: function (data) {  
				console.info("error: " + data.responseText);  
				layer.alert('提交失败！请检查Bug号是否填写正确！', {
									icon: 5,
									skin: 'layer-ext-moon'
						});
			}  
			});
			
			}	
	else{
			if(branchValue=="--请选择分支名称--"){
				layer.alert('分支名称不能为空，请选择分支名称', {
									icon: 5,
									skin: 'layer-ext-moon'
						});
			}
			if(bugNum==""){
				layer.alert('bug号不能为空', {
									icon: 5,
									skin: 'layer-ext-moon'
						});
			}
		}
}

function getNowTime2(){
		var myDate = new Date();
		//获取当前年
		var year=myDate.getFullYear();
		//获取当前月
		var month=myDate.getMonth()+1;
		//获取当前日
		var date=myDate.getDate(); 
		var h=myDate.getHours();       //获取当前小时数(0-23)
		var m=myDate.getMinutes();     //获取当前分钟数(0-59)
		var s=myDate.getSeconds(); 
		var now=year+"-"+p(month)+"-"+p(date)+"-"+p(h)+"-"+p(m)+"-"+p(s);
		return now;
	}
	
	function p(s) {
		return s < 10 ? '0' + s: s;
	}

function func(){
	layer.tips('ADD:新增配置文件 UPDATE_KEYS:修改配置项名称 UPDATE_VALUES:修改配置项值 zk端口号替换:idanlu.com :port', '#sel', {
		tips: [1, '#4F94CD'],
		time:0
	});
}
function func1(){
	layer.closeAll('tips');
}
function func2(){
	layer.tips('域名格式：www.<span style="color:red;font-weight:bold">env</span>.idanlu.com 数据库连接地址格式：jdbc:mysql://<span style="color:red;font-weight:bold">env_db:port</span>/', '#valueInput', {
		tips: [1, '#4F94CD'],
		time:0
	});
}
function func3(){
	layer.closeAll('tips');
}
 

	
	